/*
 * @Author: Cumelmell
 * @Date: 2020-04-27 17:00:36
 * @LastEditors: Cumelmell
 * @LastEditTime: 2020-04-27 17:00:36
 */
import { getCartType } from './modules/cart';
const getters = {
  token: state => state.user.token,
  avatar: state => state.user.userInfo.avatar,
  name: state => state.user.userInfo.name,
  department: state => state.user.department,
  dept_id: state => state.user.dept_id,
  departmentList: state => state.user.departmentList,
  userInfo: state => state.user.userInfo,
  menus: state => state.user.menus, // 菜单列表
  warehouse: state => state.user.warehouse, // 仓库
  settings: state => state.settings,
  cart: state => state.cart.cart, // 购物车
  // 购物车商品id
  cartIds: state => {
    const type = getCartType(state.cart);
    return _.isNull(type) ? [] : state.cart.cart[type].map(item => item.re_a_id);
  }
};
export default getters;
